package com.ssm.wechat.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.pre.service.UserService;
import com.ssm.util.object.InputObject;
import com.ssm.util.object.OutputObject;
import com.ssm.wechat.service.WechatUserService;

/**
 * 获取微信用户信息
 * @author mps
 *
 */
@Controller
public class WechatUserController {

	@Autowired
	private WechatUserService wechatUserService;//作用：躲开AOP切面的环绕通知
	
	@Autowired
	private UserService userService;//作用：进入AOP切面的环绕通知
	
	/**
	 * 检查微信公众号中已经关注的用户，获取并存储到数据库中
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatUserController/checkWechatUserByList")
	@ResponseBody
	public void checkWechatUserByList(InputObject inputObject, OutputObject outputObject) throws Exception{
		wechatUserService.checkWechatUserByList(inputObject, outputObject);
	}
	
	/**
	 * 
	 * 查找微信用户信息
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatUserController/queryWechatUserByList")
	@ResponseBody
	public void queryWechatUserByList(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.queryWechatUserByList(inputObject, outputObject);
	}
	
	/**
	 * 根据ID删除一条记录
	 * @param inputObject
	 * @param outputObject
	 * @throws Exception
	 */
	@RequestMapping("/post/WechatUserController/deleteWechatUserById")
	@ResponseBody
	public void deleteWechatUserById(InputObject inputObject, OutputObject outputObject) throws Exception{
		userService.deleteWechatUserById(inputObject, outputObject);
	}
}
